﻿using SqlSugar;

namespace ProjectScheduling_web.model
{
    [SugarTable("Projects")]
    public class Projects : BClass
    {
        public int ProjectTypeId { get; set; }
        [Navigate(NavigateType.OneToOne, nameof(ProjectTypeId))]
        public ProjectTypes? ProjectType { get; set; }
        /// <summary>
        /// 项目名称
        /// </summary>
        public string? Name { get; set; }
        /// <summary>
        /// 项目地址
        /// </summary>
        public string? Address { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string? Description { get; set; }
        /// <summary>
        /// 客户名称
        /// </summary>
        public string? CustomerName { get; set; }
        /// <summary>
        /// 联系人
        /// </summary>
        public string? Linker { get; set; }
        /// <summary>
        /// 联系电话
        /// </summary>
        public string? Phone { get; set; }
        /// <summary>
        /// 合同情况
        /// </summary>
        public string? ContractState { get; set; }
        /// <summary>
        /// 审批情况
        /// </summary>
        public string? ApproveState { get; set; }
        /// <summary>
        /// 销售名称
        /// </summary>
        [SugarColumn(ColumnName = "Salesperson")]
        public string? SalespersonName { get; set; }
        /// <summary>
        /// 销售ID
        /// </summary>
        public int SalespersonId { get; set; }
        /// <summary>
        /// 计划开始时间
        /// </summary>
        public DateTime PlanStartDate { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateDate { get; set; }
        /// <summary>
        /// 项目状态
        /// </summary>
        public Enum_ProjectState State { get; set; }
        [SugarColumn(IsIgnore = true)]
        public string StateName
        {
            get
            {
                return State.ToString();
            }
        }
        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime FromDate { get; set; }
        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime ToDate { get; set; }
        /// <summary>
        /// 进度
        /// </summary>
        public int Rate { get; set; }
        /// <summary>
        /// 项目归属
        /// </summary>
        public string? OwnerShip { get; set; }
        [Navigate(NavigateType.OneToOne, nameof(SalespersonId))]
        public Member? SaleMsg { get; set; }

        [Navigate(NavigateType.OneToMany, nameof(ProjectStaff.ProjectId))]
        public List<ProjectStaff>? StaffsList { get; set; }

        [Navigate(NavigateType.OneToMany, nameof(PreparedData.ProjectId))]
        public List<PreparedData>? PreparedDatas { get; set; }
        /// <summary>
        /// 人天消耗
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public int StaffDays { get; set; }

    }
}
